import { NextRequest, NextResponse } from 'next/server';
import { query } from '@/lib/sqlite_db';

export async function DELETE(
  request: NextRequest,
  { params }: { params: { id: string } }
) {
  try {
    const { id } = params;
    
    const sql = `DELETE FROM generation_record WHERE id = ?`;
    await query(sql, [id]);
    
    return NextResponse.json({ success: true });
  } catch (error) {
    console.error('删除记录失败:', error);
    return NextResponse.json({ error: '删除失败' }, { status: 500 });
  }
}